home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- Caption = "Form1"
- ClientHeight = 3075
- ClientLeft = 2850
- ClientTop = 2070
- ClientWidth = 7290
- Height = 3510
- Left = 2790
- LinkTopic = "Form1"
- ScaleHeight = 3075
- ScaleWidth = 7290
- Top = 1695
- Width = 7410
- Begin VB.ListBox List1
- Height = 2790
- Left = 4860
- TabIndex = 3
- Top = 120
- Width = 2355
- End
- Begin VB.CommandButton UpArrow
- Caption = "Place to hold the up arrow icon"
- DragIcon = "Form1.frx":0000
- Height = 315
- Left = 900
- TabIndex = 1
- Top = 1320
- Visible = 0 'False
- Width = 3195
- End
- Begin VB.CommandButton DownArrow
- Caption = "Place to hold the down arrow icon"
- DragIcon = "Form1.frx":030A
- Height = 315
- Left = 900
- TabIndex = 0
- Top = 1740
- Visible = 0 'False
- Width = 3195
- End
- Begin MsghookLib.Msghook Msghook1
- Left = 240
- Top = 2400
- _version = 65536
- _extentx = 1085
- _extenty = 979
- _stockprops = 0
- End
- Begin VB.Label Label1
- Caption = $"Form1.frx":0614
- Height = 1095
- Left = 180
- TabIndex = 2
- Top = 120
- Width = 4575
- End
- Begin VB.Menu PopUp
- Caption = "PopUp"
- Visible = 0 'False
- Begin VB.Menu MenuFunction
- Caption = "Function 1"
- Index = 0
- End
- Begin VB.Menu MenuFunction
- Caption = "Function 2"
- Index = 1
- End
- Begin VB.Menu MenuFunction
- Caption = "-"
- Index = 2
- End
- Begin VB.Menu MenuFunction
- Caption = "The last super function"
- Index = 3
- End
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- Dim DownIcon As Integer
- Private Sub Form_Load()
- Dim ltemplong As Long
- 'Make sure the Explorer shell is running. If not, we can't use the taskbar
- structBarData.lStructureSize = 36&
- ltemplong = SHAppBarMessage(ABM_GETTASKBARPOS, structBarData)
- If ltemplong <> 1 Then
- Exit Sub
- End If
- 'Set up the data structure for the Shell_NotifyIcon function
- structNotify.lStructureSize = 88&
- structNotify.hWnd = Me.hWnd
- structNotify.lID = 0&
- structNotify.lFlags = NIF_ICON Or NIF_MESSAGE Or NIF_TIP
- structNotify.lCallBackMessage = UM_TASKBARMESSAGE
- structNotify.hIcon = DownArrow.DragIcon
- structNotify.sTip = "A very happy tooltip!" & Chr$(0)
- ltemplong = Shell_NotifyIcon(NIM_ADD, structNotify)
- DownIcon = True
- 'Setup the message blaster to call us when we
- 'get a message from the shell notify icon
- Msghook1.HwndHook = Me.hWnd
- Msghook1.Message(UM_TASKBARMESSAGE) = True
-
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- Dim ltemplong As Long
- 'Remove icon from the taskbar
- ltemplong = Shell_NotifyIcon(NIM_DELETE, structNotify)
- End Sub
- Private Sub MenuFunction_Click(Index As Integer)
- If Index = 3 Then
- MsgBox "I really like the super function too!"
- End If
- End Sub
- Private Sub Msghook1_Message(ByVal msg As Long, ByVal wp As Long, ByVal lp As Long, result As Long)
- List1.AddItem lp, 0
- Dim Okay As Long
- 'When we get the left mouse button going up message, we'll change the icon
- If lp = 514 Then
- If DownIcon = True Then
- DownIcon = False
- 'Change icon to up arrow
- structNotify.hIcon = UpArrow.DragIcon
- structNotify.lFlags = NIF_ICON
- Okay = Shell_NotifyIcon(NIM_MODIFY, structNotify)
- 'Change tip
- structNotify.sTip = "A different happy tip!" & Chr$(0)
- structNotify.lFlags = NIF_TIP
- Okay = Shell_NotifyIcon(NIM_MODIFY, structNotify)
-
- Else
-
- DownIcon = True
- 'Change icon to down arrow
- structNotify.hIcon = DownArrow.DragIcon
- structNotify.lFlags = NIF_ICON
- Okay = Shell_NotifyIcon(NIM_MODIFY, structNotify)
- 'Change tip
- structNotify.sTip = "Back to the original tip!" & Chr$(0)
- structNotify.lFlags = NIF_TIP
- Okay = Shell_NotifyIcon(NIM_MODIFY, structNotify)
- End If
-
- End If
- 'When we get a right click, we'll pop up a menu
- If lp = 517 Then
- PopupMenu PopUp
- End If
-
- End Sub
-